package com.srxz.personnelsystem.system.service.impl;

import com.srxz.personnelsystem.system.entity.UserInfo;
import com.srxz.personnelsystem.system.mapper.converter.UserInfoMapper;
import com.srxz.personnelsystem.system.mapper.dto.UserInfoDTO;
import com.srxz.personnelsystem.system.repository.UserInfoRepository;
import com.srxz.personnelsystem.system.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @ClassName: TestServiceImpl
 * @author: wgchao
 * @createTime: 2019/1/8 3:17 PM
 * @Description: TODO
 */
@Service
public class TestServiceImpl implements TestService {
    @Autowired
    private UserInfoMapper userInfoMapper;
    @Autowired
    private UserInfoRepository userInfoRepository;

    @Override
    public UserInfoDTO hello() {

        UserInfo userInfo = new UserInfo();
//        userInfo.setUname("root");
//        userInfo.setPassword("123456");
        userInfo.setCreateTime(new Date());
        userInfo.setLastUpdateTime(new Date());

        userInfo = userInfoRepository.save(userInfo);

        return userInfoMapper.dto(userInfo);
    }
}
